<?php

declare(strict_types=1);

namespace Modules\Production\Models;

use Catch\Base\CatchModel as Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
/**
 * @property $id
 * @property $docno
 * @property $production_id
 * @property $kingdee_status
 * @property $creator_id
 * @property $created_at
 * @property $updated_at
 * @property $deleted_at
*/
class ProductionReportOrder extends Model
{


    protected $table = 'production_report_order';

    protected $fillable = [ 'id','org_code','cargo_type','cargo_code', 'docno', 'production_no','type' ,'production_id', 'kingdee_status', 'creator_id', 'created_at', 'updated_at','deletor_id', 'deleted_at' ];

    /**
     * @var array
     */
    protected array $fields = ['id','org_code','cargo_type','cargo_code','docno', 'production_no','type','production_id','kingdee_status','created_at','deletor_id'];

    /**
     * @var array
     */
    protected array $form = ['id','org_code','cargo_type','cargo_code','docno', 'production_no','type','production_id','kingdee_status','created_at','updated_at','deletor_id'];

    /**
     * @var array
     */
    public array $searchable = [
        'id' => '=',
        'docno' => '=',
        'production_no' => '=',
    ];

    /**
     * 时间格式化
     * @param $date
     * @return mixed
     */
    protected function serializeDate($date)
    {
        return $date->format('Y-m-d H:i');
    }

    /**
     * 汇报单明细
     * @return HasMany
     */
    public function detail():HasMany
    {
        return $this->hasMany(ProductionReportDetail::class,'order_id');
    }


}
